home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
FIX_DESK
/
SOURCE
/
APPLICAT.C
next >
Wrap
C/C++ Source or Header
|
1988-09-07
|
1KB
|
64 lines
#include <MacTypes.h>
#include "fix.h"
typedef struct appl_entry {
long appl_type;
long appl_directory;
unsigned char appl_name[NAME_SIZE];
} appl_entry, *appl_ptr;
Handle appl_list;
/* Perform initial application list processing. */
void pre_appl_processing()
{
if (is_hfs) {
appl_count = 0;
appl_list = NewHandle(0L); /* Clear application list... */
}
}
/* Perform final application list processing. */
void post_appl_processing()
{
#ifndef TEST_MODE
unsigned char temp;
if (is_hfs) {
kill_resource('APPL',0); /* Kill existing application list. */
temp = '\0';
AddResource(appl_list, 'APPL', 0, &temp);
WriteResource(appl_list);
ReleaseResource(appl_list);
}
#else TEST_MODE
DisposHandle(appl_list);
#endif TEST_MODE
}
/* Add a new application entry. */
void add_application(type, dir_id, name)
long type;
int dir_id;
unsigned char *name;
{
register appl_ptr blob;
register long size;
appl_count++;
blob = (appl_ptr) NewPtr((long)sizeof(appl_entry));
blob->appl_type = type;
blob->appl_directory = dir_id;
copystr(blob->appl_name, name);
size = 9 + name[0];
if (size & 1) /* Keep word-aligned... */
size++;
PtrAndHand(blob, appl_list, size);
DisposPtr(blob);
}